package com.zzyl.redis;


import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import com.zzyl.serve.domain.NursingProject;
import org.junit.jupiter.api.Test;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;

/*
* Hutool提供了HtmlUtil工具类*/
public class HttpTest {
    @Test
    public void testGet(){
        Map<String,Object> params = new HashMap<>();
        params.put("pageNum",1);
        params.put("pageSize",5);
        String result = HttpUtil.get("http://localhost:8080/nursing/project/list",params);
        System.out.println(result);
    }

    @Test
    public void testPost(){
        NursingProject nursingProject = new NursingProject();
        nursingProject.setName("护理测试项目");
        nursingProject.setOrderNo(155);
        nursingProject.setPrice(BigDecimal.valueOf(20));
        nursingProject.setUnit("次");
        nursingProject.setImage("https://ts1.tc.mm.bing.net/th/id/OIP-C.ZwitBYiR92E8l3NpzzAyKwHaHj?w=191&h=211&c=8&rs=1&qlt=90&o=6&dpr=1.5&pid=3.1&rm=2");
        nursingProject.setNursingRequirement("关注老人状态");

        String result = HttpUtil.post("http://localhost:8080/nursing/project", JSONUtil.toJsonStr(nursingProject));
        System.out.println(result);
    }
}
